﻿using BYSJ.Web.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BYSJ.Web.Models;
using BYSJ.IBLL;
using BYSJ.Web.Commmend;
using BYSJ.BLL;

namespace BYSJ.Web.Controllers
{
    //当文件分类的id=1时 为通知
    //当文件分类的id=2时 为课件
    //当文件分类的id=3时 为实验指导
    //当文件分类的id=4时 为替他
    //当文件分类的id=5时 为共享资源
    //当文件分类的id=6时 为老师推荐
    [AdminFilter]
    [ShenFen]
    public class ShareController : Controller
    {
        IFileMangSetService fileServer = null;
        Commend com = new Commend();
        public ShareController()
        {
            fileServer = new FileMangSetService();
        }

        public ActionResult Index(string Name,int pageindex)
        {
             int totalCount = 0;
             int totalCountTh = 0;
            //共享资源左侧数据 老师推荐
             var dbfilesTh = fileServer.LoadPageEntities(11, 1, out totalCountTh, u => u.Fileleibie == 6 && u.FileIsdel == false, false, a => a.FilecreatTime).ToList();
            //共享资源右侧数据
             var dbfiles = fileServer.LoadPageEntities(13, pageindex, out totalCount, u => u.Fileleibie == 5 && u.FileIsdel == false, false, a => a.FilecreatTime).ToList();
             Share share = com.shareConvert(dbfiles, pageindex, totalCount, dbfilesTh);
            return View(share);
        }

    }
}
